
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>

<%@ page import="com.easyui.common.UserLogin" %>

<%
	String pno = request.getParameter("pno");
%>
	
<script type="text/javascript" charset="UTF-8">
	var addAchiveForm;
	$(function(){
		addAchiveForm = $('#addAchiveForm').form({
				url:'servlet/AddAchiveServlet',
				onSubmit: function(){   
					var result = $("#hiddenbox input").length!=0 ? true:false; 
					if(!result) {
						$.messager.alert('请添加附件', '附件不能为空！', 'error');
						return false;
					}
					
   				 },
				success:function(msg){
					if(msg == 'ok') {
						$('#uploadDialog').dialog('close');
						 var tab = $("#menuTab").tabs('getSelected');
				 		$("#menuTab").tabs('update', {
	                       	tab:tab,
							 options:tab.panel('options')
						}); 
						$.messager.show({
							title:'提示',
							msg:'上传文件成功'
						});
					} else {
						$.messager.alert('上传文件失败','上传文件失败！','error');
						console.info('error');
					}
				}
		});
	});
		
		
	cleanAddAchive = function() {
		addAchiveForm.find('input').val('');
		addAchiveForm.find('textarea').val('');
	}
</script>


<div style="width:600px;margin:0 auto;">
		<form id="addAchiveForm" style="margin:30px auto;" method="post"  enctype="multipart/form-data">
				<table style="margin:auto;border:1px #09F solid;">
				<input type="hidden" name="pno" id="pno" value="<%= pno %>" />
					<tr>
						<td style="width:100px;text-align:left;vertical-align:top;"><b>备注</b></td>
						<td><textarea name="comment" id="comment" style="height:200px;width:450px;" ></textarea></td>
					</tr>
					<tr style="width:70px;" class="addfile">
						<td style="width:60px;text-align:left"><b>添加附件</b></td>
						<td><input type="file" name="attach" id="attach"/></td> 
					</tr>
					<tr style="width:70px;display:none;" id="hiddenbox"> <!--往后台传送数据的容器-->	
					</tr>
					<tr>
						<td colspan="2" align="right">
							<a href="javascript:void(0);" class="easyui-linkbutton"  pain="false" onclick="addAchiveForm.submit();" >确定</a>
							<a href="javascript:void(0);" class="easyui-linkbutton"  pain="false" onclick="cleanAddAchive();" >清空</a>
						</td>
					</tr>
					
				</table>
			</form>
</div>
<script type="text/javascript" src="js/addFile.js" charset="UTF-8"></script> 